<%--<%@page import="com.sdry.entity.permission.UpmsStaffRole"%>--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page import="com.sdry.entity.base.Staff"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
  <title>业务管理员</title>
  <link href="${pageContext.request.contextPath}/Lanai/css/lanai-ui.css" rel="stylesheet" />
  <script type="text/javascript" src="${pageContext.request.contextPath }/Lanai/js/jquery.min.js"></script>
  
  <%
	Staff staff = (Staff)session.getAttribute("staff");
    Long d = null;
    String name = null;
    String scode = null;
    Long staffId = null;
    if(staff != null){
      d = staff.getPid();
      name = staff.getSname();
      scode = staff.getScode();
      staffId = staff.getStaid();
    }
  %>
  <style type="text/css">
	  .treeview-menu{
	   	padding-left: 25px;
	  }
  </style>
</head>

<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
  <!-- Main Header -->
  <header class="main-header">
    <!-- Logo -->
    <a href="${pageContext.request.contextPath}/login/toLogin.do" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini"><b>L</b>AI</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg"><b>审批流程管理系统</b></span>
    </a>
    <!-- Header Navbar -->
    <nav class="navbar navbar-static-top" role="navigation">
      <!-- Sidebar toggle button-->
      <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">Toggle navigation</span>
      </a>
      <!-- Navbar Right Menu -->
      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <!-- User Account Menu -->
          <li class="user user-menu">
            <!-- Menu Toggle Button -->
            <a href="#" >
              <!-- The user image in the navbar-->
              <img src="Lanai/img/sl.jpg" class="user-image" alt="User Image" />
              <!-- hidden-xs hides the username on small devices so only the image appears. -->
              <span class="hidden-xs"><%=name%></span>
            </a>
          </li>
        </ul>
      </div>
    </nav>
  </header>
  <!-- 左菜单-->
  <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- Sidebar Menu -->
      <ul class="sidebar-menu" data-widget="tree">
       	
       	<li class="treeview">
          <a href="#">
            <i class="fa fa-folder"></i> <span>所有文档</span>
            <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
	        <li><a href="#" data-addtab="profile合同协议" data-target="#MasterTabs" data-title="项目文档" data-url="${pageContext.request.contextPath}/agreement/pageToAgreement.do"><i class="fa fa-circle-o"></i> 项目文档 </a></li>
	        <li><a href="#" data-addtab="profile单据统计" data-target="#MasterTabs" data-title="单据统计" data-url="${pageContext.request.contextPath}/billForm/pageTobillForm.do"><i class="fa fa-circle-o"></i> 单据统计 </a></li>
          </ul>
        </li>
        <li class="treeview">
          <a href="#">
            <i class="fa fa-folder"></i> <span>审批管理</span>
            <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <c:if test="${staff.sreserve2 == '是' }">
	            <li><a href="#" data-addtab="waitApproval" data-target="#MasterTabs" data-title="待办事件" data-url="${pageContext.request.contextPath}/approval/waitApproval.do"><i class="fa fa-circle-o"></i>待办事件</a></li>
            </c:if>
            <c:if test="${department.dname == '财务部' }">
            	<li><a href="#" data-addtab="alreadyApproval" data-target="#MasterTabs" data-title="结算" data-url="${pageContext.request.contextPath}/approval/alreadyApproval.do"><i class="fa fa-circle-o"></i>结算</a></li>
            </c:if>
            <c:if test="${department.dname != '财务部' }">
            	<li><a href="#" data-addtab="alreadyApproval" data-target="#MasterTabs" data-title="已办事件" data-url="${pageContext.request.contextPath}/approval/alreadyApproval.do"><i class="fa fa-circle-o"></i>已办事件</a></li>
            </c:if>
            
	        <li><a href="#" data-addtab="profile" data-target="#MasterTabs" data-title="项目文档" data-url="${pageContext.request.contextPath}/agreement/pageToAgreement.do?aremark9=<%=staffId%>"><i class="fa fa-circle-o"></i>项目文档 </a></li>
          </ul>
        </li>
       	<li class="treeview">
          <a href="#">
            <i class="fa fa-folder"></i> <span>我的文档</span>
            <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
	        <li><a href="#" data-addtab="单据统计" data-target="#MasterTabs" data-title="单据统计" data-url="${pageContext.request.contextPath}/billForm/pageTobillForm.do?bfremark12=<%=staffId%>"><i class="fa fa-circle-o"></i> 单据统计 </a></li>
            <%-- <li><a href="#" data-addtab="myContent" data-target="#MasterTabs" data-title="私有文档" data-url="${pageContext.request.contextPath}/jumpPage/content.do"><i class="fa fa-circle-o"></i> 私有文档 </a></li> --%>
          </ul>
        </li>
      </ul>
      <div class="sidebar-footer hidden-small fadeInLeft animated">
      
      	<!-- 下标签-->
	  <!-- /.content-wrapper -->
	  <!-- Main Footer -->
	  <div style="color: #b8c7ce4d;">
	    <!-- To the right -->
	    <div class="pull-right hidden-xs">
	      <b>Version</b> 1.0.0.1
	    </div>
	    <!-- Default to the left -->
	    <strong>北京盛达融元 © 2018-2019 .</strong> All rights reserved.
	  </div>
      
      
        <!-- 根据data-widget刷新中心界面打开页面    laian-ui.js写死的-->
        <a data-toggle="tooltip" data-placement="top" data-original-title="refresh" data-widget="tooltip-refresh">
          <span class="fa fa-refresh" aria-hidden="true"></span>
        </a>
        <!-- 根据data-widget全屏    laian-ui.js写死的-->
        <a id="fullscreen" data-toggle="tooltip" data-placement="top" title="" data-original-title="FullScreen" data-widget="tooltip-fullscreen">
          <span class="fa fa-arrows-alt" aria-hidden="true"></span>
        </a>
        <!--根据data-widget打开id为modal的div   laian-ui.js写死的-->
        <a id="lockpage" data-toggle="tooltip" data-placement="top" title="" data-original-title="Lock" data-widget="tooltip-lock">
          <span class="fa fa-eye-slash" aria-hidden="true"></span>
        </a>
        <!--关闭退出-->
        <a data-toggle="tooltip" data-placement="top" title="" href="${pageContext.request.contextPath}/login/toLogin.do" data-original-title="Logout">
          <span class="fa fa-power-off" aria-hidden="true"></span>
        </a>
      </div>
    </section>
    <!-- /.sidebar -->
  </aside>
  <!-- Content Wrapper. Contains page content -->

  <!-- 中心 -->
  <div class="content-wrapper">
    <!-- Main content -->
    <section class="content container-fluid" style="padding:0px">
      <ul class="nav nav-tabs menu-tabs" id="MasterTabs" role="tablist">
        <li class="nav-tabs-header active" role="presentation">
          <a aria-controls="home" data-toggle="tab" href="#home" role="tab">
            <i class="fa fa-home"></i> 待办事件
          </a>
        </li>
      </ul>
      <!-- Tab panes -->
      <div class="tab-content fixheight">
        <div class="tab-pane active" id="home" role="tabpanel">
			<iframe src="${pageContext.request.contextPath}/approval/waitApproval.do" width="100%" height="900px" style="overflow: hidden; border:none;"></iframe>
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  
  <!--Small Chat-->
  <div class="box small-chat-box direct-chat direct-chat-primary  fadeInRight animated" data-widget="chat-small-box">
    <div class="box-header with-border">
      <h3 class="box-title" id="chatTitle">LAI聊</h3>
      <div class="box-tools pull-right">
        <button type="button" id="btn_showContacts" class="btn btn-box-tool" data-toggle="tooltip" title="" data-widget="chat-pane-toggle" data-original-title="Contacts">
          <i class="fa fa-comments"></i>
        </button>
      </div>
    </div>

    <div class="chat-area">
      <span class="badge badge-warning pull-right msgCount">2</span>
      <a class="open-small-chat" data-widget="chat-small-open">
        <i class="fa fa-comments"></i>
      </a>
    </div>
    <!-- /. Chat-Area-->
  </div>

  <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close closefm" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="exampleModalLabel">
            <span style="font-size:13px">修改密码</span>
          </h4>
        </div>
        <div class="modal-body">
          <form id="fm" class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-2 control-label">密码:</label>
              <div class="col-sm-8">
                <input type="password" name="pass" id="pass" class="col-xs-12 col-sm-4 form-control"/>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">确认密码:</label>
              <div class="col-sm-8">
                <input type="password" name="pass2" id="pass2" class="col-xs-12 col-sm-4 form-control"/>
              </div>
            </div>

          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
          <button type="submit" class="btn btn-primary submit" onclick="save()">保存</button>
        </div>
      </div>
    </div>
  </div>
  <script type="text/javascript">
      $(function () {
          //初始化提示框的位置：top-center，bottom-left，bottom-right
          toastr.options.positionClass = 'toast-top-center';
          //模态框关闭事件
          $('#exampleModal').on('hide.bs.modal',function(){
              //表单清空
              $("#fm")[0].reset();
          });
          //jQuery，既阻止默认行为又停止冒泡  导入按钮
          $(".submit").on('click',function(){
              return false;//当然 也阻止了事件本身
          });

      });
      //表单提交
      function save() {

          var pass = $("#pass").val();
          var pass2 = $("#pass2").val();
          if(pass == "" || pass == null){
              toastr.error("密码不能为空！");
          }else if(pass != pass2){
              toastr.error("请确认密码！");
          }else{
              pass = md5($("#pass").val());
              var data = "staffId = "+<%=staffId%>+"&pass = "+pass;
              var url = "${pageContext.request.contextPath }/upmsStaff/update.do";
              var title = "修改";
              $.post(url, data, function(data) {
                  if (data == 1) {
                      toastr.success(title+'成功');
                      setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                          $('#exampleModal').modal('hide');
                          $('#tb_table').bootstrapTable('refresh');
                          refresh();
                      },1000);
                  } else {
                      toastr.error(title+'失败');
                  }
              });
          }
      }
  </script>
  <%--锁屏后弹出的界面--%>
  <!-- ./wrapper -->
  <div id="modal" class="hold-transition lockscreen" style="display:none">
    <div class="lockscreen-wrapper">
      <div class="lockscreen-logo">
        <a href="#"><b>审批流程</b>管理系统</a>
      </div>
      <div class="lockscreen-name"><span><%=name%></span></div>
      <div class="lockscreen-item">
        <div class="lockscreen-image">
          <img src="Lanai/img/sl.jpg" />
        </div>
        <form class="lockscreen-credentials">
          <div class="input-group">
            <input id="tbx_lock_password" type="password" class="form-control" placeholder="password" value="">
            <input type="hidden" id="tbx_lock_name" value="<%=scode%>">

            <div class="input-group-btn">
              <!--点击根据data-widget关闭modal -->
              <button type="button" class="btn" onclick="pageGodEntry()" data-placement="top" title=""><i class="fa fa-arrow-right text-muted"></i></button>
              <button type="button" id="unlock" style="display:none;" class="btn" data-widget="tooltip-unlock" data-placement="top" title=""><i class="fa fa-arrow-right text-muted"></i></button>
            </div>
          </div>
        </form>
      </div>
      <div class="help-block text-center">
        输入密码解除锁定
      </div>
      <div class="lockscreen-footer text-center">
        <span id="nameerr"></span>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="${pageContext.request.contextPath}/js/md5.js"></script>
  <script type="text/javascript">

      function pageGodEntry() {
          var scode = $("#tbx_lock_name").val();
          var pass = $("#tbx_lock_password").val();
          if(pass == "" || pass == null){
              $("#nameerr").html("请输入密码！");
              return;
          }
          pass = md5($("#tbx_lock_password").val());
          $.ajax({
              type: "POST",
              url:"${pageContext.request.contextPath}/login/login.do",
              data:"scode="+scode+"&pass="+pass,
              success: function(data) {
                  if (data == 0) {
                      $("#nameerr").html("密码不正确！");
                  }else {
                      $("#tbx_lock_password").val("");
                      document.getElementById("unlock").click();
                  }
              }
          });
      }
  </script>

  <!-- ./ 锁定屏幕 -->
  <script src="${pageContext.request.contextPath}/Lanai/js/jquery.min.js"></script>
  <script src="${pageContext.request.contextPath}/Lanai/js/lanai-ui.js"></script>
</div>
</body>
</html>
